const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
  entry: './src/index.js',
  output: {
    filename: '[name].js',
    path: path.resolve(__dirname, 'dist'),
  },
  devServer: {
    static: './dist',
    proxy: {
      '/v': {
        target:'https://apis.netstart.cn',
        changeOrigin:true,
        pathRewrite: { '^/v': '' }
      },
    },
  },
  optimization: {
    runtimeChunk: 'single',
    splitChunks: {
      cacheGroups: {
        commons: {
          test: /[\\/]node_modules[\\/]/,
          name: 'vendors',
          chunks: 'all',
        },
      },
    },
  },
  plugins: [new HtmlWebpackPlugin({
    template:"./static/index.html",
    inject:"body"
  })],
  mode:"development"
};